package com.prism.moodme.app;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JPanel;

import com.prism.moodme.util.Utility;

public class SearchAction extends AbstractAction {

	private SearchPanel searchPane;
	private String query = "";

	public SearchAction(SearchPanel searchPane){
		super("SEARCH");
		setSearchPane(searchPane);


	}
	@Override
	public void actionPerformed(ActionEvent e) {
		StringBuilder sb = new StringBuilder();
		sb.append(getSearchPane().month);sb.append("\t");
		sb.append(getSearchPane().day);sb.append("\t");
		sb.append(getSearchPane().hour);sb.append("\t");
		sb.append(getSearchPane().min);
		setQuery(sb.toString());
//		String map = Utility.getData(getQuery());

	}

	private void setSearchPane(SearchPanel searchPane) {
		this.searchPane = searchPane;
	}
	public SearchPanel getSearchPane() {
		return searchPane;
	}
	public void setQuery(String query) {
		this.query = query;
	}
	public String getQuery() {
		return query;
	}

	public String toString(){
		return getQuery();
	}

}
